﻿using AiQiuQuan.Sport.Model.Enums;
using System.ComponentModel.DataAnnotations;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 约球状态更改请求
    /// </summary>
    public class BallStateUpdateDto : IValidatableObject
    {
        /// <summary>
        /// 编号
        /// </summary>
        [Required]
        public Guid ID { get; set; }

        /// <summary>
        /// 约球状态：1报名中、3进行中、4已结束、9已取消
        /// </summary>
        [Required]
        [EnumDataType(typeof(GameStateEnum), ErrorMessage = "状态不正确")]
        public GameStateEnum State { get; set; }

        /// <summary>
        /// validate
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (State == GameStateEnum.Joining)
            {
                yield return new ValidationResult("约球状态不正确");
                yield break;
            }
        }
    }
}
